inline
Proactor::Proactor (ProactorImpl *impl/* = 0*/,
	int delete_impl/* = 0*/)
: delete_implementation_ (delete_impl)
, implementation_ (impl)
{

}
inline
Proactor::~Proactor ()
{

}
inline
Proactor *Proactor::instance (void)
{
    if (Proactor::proactor_ == 0)
    {
	Guard_T<ThreadMutex> g (Proactor::instance_lock_);
	if (Proactor::proactor_ == 0)
	{
	    Proactor::proactor_ = new Proactor();
	    Proactor::delete_proactor_ = 1;
	}
    }
    return Proactor::proactor_;
}
inline
Proactor *Proactor::instance (Proactor *proactor,
	int delete_proactor/* = 0*/)
{
    Proactor *t = Proactor::proactor_;
    Proactor::delete_proactor_ = delete_proactor;

    Proactor::proactor_ = proactor;
    return t;
}
inline
void Proactor::close_singleton (void)
{
    Guard_T<ThreadMutex> g (Proactor::instance_lock_);
    if (Proactor::delete_proactor_)
    {
	delete Proactor::proactor_;
	Proactor::proactor_ = 0;
	Proactor::delete_proactor_ = 0;
    }
}
inline
int Proactor::run_proactor_event_loop (void)
{
    return this->implementation_->run_event_loop ();
}
inline
void Proactor::end_proactor_event_loop (void)
{
    this->implementation_->end_event_loop ();
}
inline
int Proactor::proactor_event_loop_done (void)
{
    return this->implementation_->event_loop_done ();
}
inline
int Proactor::register_handle (NDK_HANDLE handle,
	    const void *completion_key,
	    int event_mask)
{
    return this->implementation_->register_handle (handle, 
	    completion_key,
	    event_mask);
}
inline
int Proactor::handle_events (const TimeValue *wait_time)
{
    return this->implementation_->handle_events (wait_time);
}
inline
size_t Proactor::number_of_threads (void) const
{
    return this->implementation_->number_of_threads ();
}
inline
void Proactor::number_of_threads (size_t threads)
{
    return this->implementation_->number_of_threads (threads);
}
inline
ProactorImpl *Proactor::implementation (void) const
{
    return this->implementation_;
}
inline
AsynchReadStreamImpl *Proactor::create_asynch_read_stream (void)
{
    return this->implementation_->create_asynch_read_stream ();
}
inline
AsynchReadStreamResultImpl *Proactor::create_asynch_read_stream_result (
	const AsynchHandler *asynch_handler,
	NDK_HANDLE handle,
	MessageBlock *mb,
	size_t bytes_to_read)
{
    return this->implementation_->create_asynch_read_stream_result (
	    asynch_handler,
	    handle,
	    mb,
	    bytes_to_read);
}
inline
AsynchWriteStreamImpl *Proactor::create_asynch_write_stream (void)
{
    return this->implementation_->create_asynch_write_stream ();
}
inline
AsynchWriteStreamResultImpl *Proactor::create_asynch_write_stream_result (
	const AsynchHandler *asynch_handler,
	NDK_HANDLE handle,
	MessageBlock *mb,
	size_t bytes_to_write)
{
    return this->implementation_->create_asynch_write_stream_result (
	    asynch_handler,
	    handle,
	    mb,
	    bytes_to_write);
}
inline
AsynchAcceptImpl *Proactor::create_asynch_accept (void)
{
    return this->implementation_->create_asynch_accept ();
}
inline
AsynchAcceptResultImpl *Proactor::create_asynch_accept_result (
	const AsynchHandler *asynch_handler,
	NDK_HANDLE listen_handle,
	MessageBlock *mb,
	size_t bytes_to_read)
{
    return this->implementation_->create_asynch_accept_result (
	    asynch_handler,
	    listen_handle,
	    mb, 
	    bytes_to_read);
}

